;; 皮肤
(use-package atom-one-dark-theme
  :ensure t
  :init 
  (load-theme 'atom-one-dark t)
)
;; 启动页面
(use-package dashboard
  :ensure t
  :config
  (setq dashboard-banner-logo-title "Linyupark's Finally Editor, Happy Coding~")
  (setq dashboard-startup-banner "~/.emacs.d/logo.png")
  (setq dashboard-items '(
    (recents  . 20) (bookmarks . 20))
  )
  (dashboard-setup-startup-hook)
)

;; 恢复上一次页面
(desktop-save-mode t)

;; 状态栏
(use-package powerline
  :ensure t
  :config
  (powerline-default-theme)
)

;; 光标样式
(setq-default cursor-type 'bar)
;; 默认换行
(global-visual-line-mode t)
;; 显示时间
(display-time-mode t)
;; 侧边显示行号
(global-display-line-numbers-mode t)
(setq-default line-spacing 0.2)
;; 括号匹配高亮
(show-paren-mode t)
;; 当前行高亮
(global-hl-line-mode t)
;; 自定义标题
(setq frame-title-format
  (list (format "%s %%S: %%j" (system-name))
    '(buffer-file-name "%f" (dired-directory dired-directory "%b"))))
;; 隐藏
; (menu-bar-mode 0)
(tool-bar-mode 0)
(scroll-bar-mode 0)
;; 静音
(setq visible-bell t)
(setq ring-bell-function 'ignore)
;; 自动加括号
(electric-pair-mode t)
;; 空格代替 tab
(setq-default indent-tabs-mode nil)
;; 字体设置
(set-language-environment "UTF-8")
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
;; 高亮选中
(transient-mark-mode 1) 
;; 删除选中
(delete-selection-mode 1)
(when (window-system)
  (set-frame-font "Fira Code"))
(let ((alist '((33 . ".\\(?:\\(?:==\\|!!\\)\\|[!=]\\)")
               (35 . ".\\(?:###\\|##\\|_(\\|[#(?[_{]\\)")
               (36 . ".\\(?:>\\)")
               (37 . ".\\(?:\\(?:%%\\)\\|%\\)")
               (38 . ".\\(?:\\(?:&&\\)\\|&\\)")
               (42 . ".\\(?:\\(?:\\*\\*/\\)\\|\\(?:\\*[*/]\\)\\|[*/>]\\)")
               (43 . ".\\(?:\\(?:\\+\\+\\)\\|[+>]\\)")
               (45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
               (46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=-]\\)")
               (47 . ".\\(?:\\(?:\\*\\*\\|//\\|==\\)\\|[*/=>]\\)")
               (48 . ".\\(?:x[a-zA-Z]\\)")
               (58 . ".\\(?:::\\|[:=]\\)")
               (59 . ".\\(?:;;\\|;\\)")
               (60 . ".\\(?:\\(?:!--\\)\\|\\(?:~~\\|->\\|\\$>\\|\\*>\\|\\+>\\|--\\|<[<=-]\\|=[<=>]\\||>\\)\\|[*$+~/<=>|-]\\)")
               (61 . ".\\(?:\\(?:/=\\|:=\\|<<\\|=[=>]\\|>>\\)\\|[<=>~]\\)")
               (62 . ".\\(?:\\(?:=>\\|>[=>-]\\)\\|[=>-]\\)")
               (63 . ".\\(?:\\(\\?\\?\\)\\|[:=?]\\)")
               (91 . ".\\(?:]\\)")
               (92 . ".\\(?:\\(?:\\\\\\\\\\)\\|\\\\\\)")
               (94 . ".\\(?:=\\)")
               (119 . ".\\(?:ww\\)")
               (123 . ".\\(?:-\\)")
               (124 . ".\\(?:\\(?:|[=|]\\)\\|[=>|]\\)")
               (126 . ".\\(?:~>\\|~~\\|[>=@~-]\\)")
               )
             ))
  (dolist (char-regexp alist)
    (set-char-table-range composition-function-table (car char-regexp)
                          `([,(cdr char-regexp) 0 font-shape-gstring]))))


(provide 'init-ui)
